function constructionManagementFRefresh() {
  constructionManagementF(function () {});
}
setInterval(constructionManagementFRefresh, 5000);
function constructionManagementF(fn) {}
constructionManagementF(function () {});
// 安全隐患整改闭合率;
hiddenDangerEchartJ();
function hiddenDangerEchartJ() {
  let hiddenDangerEJ = document.getElementsByClassName("hiddenDangerEchartJ");
  for (var i = 0; i < hiddenDangerEJ.length; i++) {
    let myChart = echarts.init(hiddenDangerEJ[i]);
    let color = ["#FF8700", "#ffc300", "#00e473", "#009DFF"];
    let chartData = [
      {
        name: "10号线二期",
        value: 98,
        unit: "个",
      },
      {
        name: "14号线",
        value: 123,
        unit: "个",
      },
      {
        name: "15号线",
        value: 127,
        unit: "个",
      },
      {
        name: "18号线",
        value: 115,
        unit: "个",
      },
    ];
    let arrName = [];
    let arrValue = [];
    let sum = 0;
    let pieSeries = [],
      lineYAxis = [];

    // 数据处理
    chartData.forEach((v, i) => {
      arrName.push(v.name);
      arrValue.push(v.value);
      sum = sum + v.value;
    });

    // 图表option整理
    chartData.forEach((v, i) => {
      pieSeries.push({
        name: "学历",
        type: "pie",
        clockWise: false,
        hoverAnimation: false,
        radius: [80 - i * 15 + "%", 70 - i * 15 + "%"],
        center: ["50%", "40%"],
        label: {
          show: false,
        },
        data: [
          {
            value: v.value,
            name: v.name,
          },
          {
            value: sum - v.value,
            name: "",
            itemStyle: {
              color: "rgba(0,0,0,0)",
            },
          },
        ],
      });
      pieSeries.push({
        name: "",
        type: "pie",
        silent: true,
        z: 1,
        clockWise: false, //顺时加载
        hoverAnimation: false, //鼠标移入变大
        radius: [80 - i * 15 + "%", 70 - i * 15 + "%"],
        center: ["50%", "40%"],
        label: {
          show: false,
        },
        data: [
          {
            value: 7.5,
            itemStyle: {
              color: "#E3F0FF",
            },
          },
          {
            value: 2.5,
            name: "",
            itemStyle: {
              color: "rgba(0,0,0,0)",
            },
          },
        ],
      });
      v.percent = ((v.value / sum) * 100).toFixed(1) + "%";
      lineYAxis.push({
        value: i,
        textStyle: {
          rich: {
            circle: {
              color: color[i],
              padding: [0, 5],
            },
          },
        },
      });
    });

    option = {
      color: color,
      title: {
        text: "安全隐患数",
        left: "48%",
        bottom: "0%",
        textAlign: "center",
        textStyle: {
          fontWeight: "normal",
          fontSize: "16",
          color: "#fff",
          textAlign: "center",
        },
      },
      grid: {
        top: "2%",
        bottom: "64%",
        left: "35%",
        containLabel: false,
      },
      yAxis: [
        {
          type: "category",
          inverse: true,
          axisLine: {
            show: false,
          },
          axisTick: {
            show: false,
          },
          axisLabel: {
            formatter: function (params) {
              let item = chartData[params];
              console.log(item);
              return (
                "{line|}{circle|●}{name|" +
                item.name +
                "}-{value|" +
                item.value +
                "}{unit|个}"
              );
            },
            interval: 0,
            inside: true,
            textStyle: {
              color: "#fff",
              fontSize: 14,
              rich: {
                line: {
                  width: 35,
                  //   height: 10,
                  // backgroundColor: { image: dashedPic },
                },
                name: {
                  color: "#fff",
                  fontSize: 12,
                },
                bd: {
                  color: "#fff",
                  //   padding: [0, 5],
                  fontSize: 12,
                },
                percent: {
                  color: "#fff",
                  fontSize: 14,
                },
                value: {
                  color: "#fff",
                  fontSize: 12,
                  fontWeight: 500,
                  //   padding: [0, 0, 0, 20],
                },
                unit: {
                  fontSize: 12,
                },
              },
            },
            show: true,
          },
          data: lineYAxis,
        },
      ],
      xAxis: [
        {
          show: false,
        },
      ],
      series: pieSeries,
    };
    myChart.setOption(option);
  }
  let hiddenDangerEtJ = document.getElementsByClassName("hiddenDangerEcharttJ");
  for (var i = 0; i < hiddenDangerEtJ.length; i++) {
    let myChart = echarts.init(hiddenDangerEtJ[i]);
    let color = ["#FF8700", "#ffc300", "#00e473", "#009DFF"];
    let chartData = [
      {
        name: "10号线二期",
        value: 98,
        unit: "个",
      },
      {
        name: "14号线",
        value: 123,
        unit: "个",
      },
      {
        name: "15号线",
        value: 127,
        unit: "个",
      },
      {
        name: "18号线",
        value: 115,
        unit: "个",
      },
    ];
    let arrName = [];
    let arrValue = [];
    let sum = 0;
    let pieSeries = [],
      lineYAxis = [];

    // 数据处理
    chartData.forEach((v, i) => {
      arrName.push(v.name);
      arrValue.push(v.value);
      sum = sum + v.value;
    });

    // 图表option整理
    chartData.forEach((v, i) => {
      pieSeries.push({
        name: "学历",
        type: "pie",
        clockWise: false,
        hoverAnimation: false,
        radius: [80 - i * 15 + "%", 70 - i * 15 + "%"],
        center: ["50%", "40%"],
        label: {
          show: false,
        },
        data: [
          {
            value: v.value,
            name: v.name,
          },
          {
            value: sum - v.value,
            name: "",
            itemStyle: {
              color: "rgba(0,0,0,0)",
            },
          },
        ],
      });
      pieSeries.push({
        name: "",
        type: "pie",
        silent: true,
        z: 1,
        clockWise: false, //顺时加载
        hoverAnimation: false, //鼠标移入变大
        radius: [80 - i * 15 + "%", 70 - i * 15 + "%"],
        center: ["50%", "40%"],
        label: {
          show: false,
        },
        data: [
          {
            value: 7.5,
            itemStyle: {
              color: "#E3F0FF",
            },
          },
          {
            value: 2.5,
            name: "",
            itemStyle: {
              color: "rgba(0,0,0,0)",
            },
          },
        ],
      });
      v.percent = ((v.value / sum) * 100).toFixed(1) + "%";
      lineYAxis.push({
        value: i,
        textStyle: {
          rich: {
            circle: {
              color: color[i],
              padding: [0, 5],
            },
          },
        },
      });
    });

    option = {
      color: color,
      title: {
        text: "整改闭合数",
        left: "48%",
        bottom: "0%",
        textAlign: "center",
        textStyle: {
          fontWeight: "normal",
          fontSize: "16",
          color: "#fff",
          textAlign: "center",
        },
      },
      grid: {
        top: "2%",
        bottom: "64%",
        left: "35%",
        containLabel: false,
      },
      yAxis: [
        {
          type: "category",
          inverse: true,
          axisLine: {
            show: false,
          },
          axisTick: {
            show: false,
          },
          axisLabel: {
            formatter: function (params) {
              let item = chartData[params];
              console.log(item);
              return (
                "{line|}{circle|●}{name|" +
                item.name +
                "}-{value|" +
                item.value +
                "}{unit|个}"
              );
            },
            interval: 0,
            inside: true,
            textStyle: {
              color: "#fff",
              fontSize: 14,
              rich: {
                line: {
                  width: 35,
                  //   height: 10,
                  // backgroundColor: { image: dashedPic },
                },
                name: {
                  color: "#fff",
                  fontSize: 12,
                },
                bd: {
                  color: "#fff",
                  //   padding: [0, 5],
                  fontSize: 12,
                },
                percent: {
                  color: "#fff",
                  fontSize: 14,
                },
                value: {
                  color: "#fff",
                  fontSize: 12,
                  fontWeight: 500,
                  //   padding: [0, 0, 0, 20],
                },
                unit: {
                  fontSize: 12,
                },
              },
            },
            show: true,
          },
          data: lineYAxis,
        },
      ],
      xAxis: [
        {
          show: false,
        },
      ],
      series: pieSeries,
    };
    myChart.setOption(option);
  }
  let hiddenDangercloseC = document.getElementsByClassName(
    "hiddenDangercloseEchart"
  );
  for (var i = 0; i < hiddenDangercloseC.length; i++) {
    let myChart = echarts.init(hiddenDangercloseC[i]);
    var value = 100;
    option = {
      title: {
        text: `${value}%`,
        subtext: "安全隐患整改闭合率",
        left: "center",
        top: "center", //top待调整
        textStyle: {
          color: "#fff",
          fontSize: 20,
          fontFamily: "DINAlternate-Bold",
        },
        subtextStyle: {
          color: "#ff",
          fontSize: 12,
          fontFamily: "PingFangSC-Regular",
          top: "center",
        },
        itemGap: -4, //主副标题间距
      },
      xAxis: {
        splitLine: {
          show: false,
        },
        axisLabel: {
          show: false,
        },
        axisLine: {
          show: false,
        },
        // data: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']
      },
      yAxis: {
        splitLine: {
          show: false,
        },
        axisLabel: {
          show: false,
        },
        axisLine: {
          show: false,
        },
      },
      series: [
        // 内圆
        {
          type: "pie",
          radius: ["0", "48%"],
          center: ["50%", "50%"],
          z: 0,
          label: {
            normal: {
              position: "inner",
              show: false,
            },
          },
          itemStyle: {
            normal: {
              color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
                {
                  offset: 0,
                  color: "#1147A1",
                },
                {
                  offset: 0.5,
                  color: "#423DB3",
                },
                {
                  offset: 1,
                  color: "#1147A1",
                },
              ]),
              label: {
                show: false,
              },
              labelLine: {
                show: false,
              },
            },
          },
          label: {
            normal: {
              position: "center",
            },
          },
          data: [100],
        },
        // 进度圈
        {
          type: "pie",
          clockWise: true,
          radius: ["60%", "59%"],
          label: {
            normal: {
              position: "inner",
              show: false,
            },
          },
          data: [
            {
              value: value,
              itemStyle: {
                normal: {
                  borderWidth: 10,
                  borderColor: {
                    colorStops: [
                      {
                        offset: 0,
                        color: "#7940FE" || "#00cefc", // 0% 处的颜色
                      },
                      {
                        offset: 1,
                        color: "#2A69EC" || "#367bec", // 100% 处的颜色
                      },
                    ],
                  },
                  color: {
                    // 完成的圆环的颜色
                    colorStops: [
                      {
                        offset: 0,
                        color: "#7940FE" || "#00cefc", // 0% 处的颜色
                      },
                      {
                        offset: 1,
                        color: "#2A69EC" || "#367bec", // 100% 处的颜色
                      },
                    ],
                  },
                  label: {
                    show: false,
                    position: "inner",
                  },
                  labelLine: {
                    show: false,
                  },
                },
              },
            },
            {
              name: "gap",
              value: 100 - value,
              itemStyle: {
                normal: {
                  label: {
                    show: false,
                  },
                  labelLine: {
                    show: false,
                  },
                  color: "rgba(0, 0, 0, 0)",
                  borderColor: "rgba(0, 0, 0, 0)",
                  borderWidth: 0,
                },
              },
            },
          ],
        },
        //刻度尺
        {
          // name: "白色圈刻度",
          type: "gauge",
          radius: "85%",
          startAngle: 225, //刻度起始
          endAngle: -134.8, //刻度结束
          z: 4,
          axisTick: {
            show: true,
            lineStyle: {
              width: 2,
              color: "rgba(1,244,255, 0.9)",
            },
          },
          splitLine: {
            length: 12, //刻度节点线长度
            lineStyle: {
              width: 2,
              color: "rgba(1,244,255, 0.9)",
            }, //刻度节点线
          },
          axisLabel: {
            color: "rgba(255,255,255,0)",
            fontSize: 12,
          }, //刻度节点文字颜色
          pointer: {
            show: false,
          },
          axisLine: {
            lineStyle: {
              opacity: 0,
            },
          },
          detail: {
            show: false,
          },
          data: [
            {
              value: 0,
              name: "",
            },
          ],
        },
        // 刻度圈
        {
          type: "pie",
          radius: ["0%", "70%"],
          center: ["50%", "50%"],
          avoidLabelOverlap: false,
          label: {
            normal: {
              show: false,
              position: "center",
            },
            emphasis: {
              show: false,
              textStyle: {
                fontWeight: "bold",
              },
            },
          },
          itemStyle: {
            normal: {
              color: {
                type: "linear",
                x: 0,
                y: 0,
                x2: 0,
                y2: 1,
                colorStops: [
                  {
                    offset: 0.05,
                    color: "rgba(32,36,107, 0.2)",
                  },
                  {
                    offset: 0.5,
                    color: "rgba(32,36,107,0.3)",
                  },
                  {
                    offset: 0.95,
                    color: "rgba(32,36,107, 0.2)",
                  },
                ],
              },
            },
          },
          labelLine: {
            normal: {
              show: false,
            },
            labelLine: {
              show: false,
            },
          },
          data: [
            {
              value: 3235,
            },
          ],
        },
        //最外层圈
        {
          type: "pie",
          radius: ["0%", "80%"],
          center: ["50%", "50%"],
          avoidLabelOverlap: false,
          hoverAnimation: false,
          label: {
            normal: {
              show: false,
              position: "center",
            },
            emphasis: {
              show: false,
              textStyle: {
                fontWeight: "bold",
              },
            },
          },
          itemStyle: {
            normal: {
              color: {
                type: "linear",
                x: 0,
                y: 0,
                x2: 0,
                y2: 1,
                colorStops: [
                  {
                    offset: 0.05,
                    color: "rgba(21,24,65, 0.2)",
                  },
                  {
                    offset: 0.5,
                    color: "rgba(21,24,65, 0.3)",
                  },
                  {
                    offset: 0.95,
                    color: "rgba(21,24,65, 0.2)",
                  },
                ],
              },
            },
          },
          labelLine: {
            normal: {
              show: false,
            },
          },
          data: [
            {
              value: 3235,
            },
          ],
        },
      ],
    };
    myChart.setOption(option);
  }
}
